<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div class="app">
        <p>{{title}}</p>
        <input type="text" v-model="title">
        <div v-if="flag">

            <img v-bind:src="imgsrc" alt=" ">
        </div>
        <button @click="flag=!flag">点击切换显示图片{{flag}}</button>
        <div>
            <span>{{num}}</span><button @click="changenum">点击改变数值</button>
        </div>
        <div>
            <p>{{cont}}</p>
            <input type="text" @input="changeinp">
        </div>
    </div>
</body>
<script>
    const vm = new Vue({
        el: ".app ",
        data: {
            title: "你好 ",
            imgsrc: "./images/1642131151272.jpg",
            num: 0,
            flag: true,
            cont: "元宵节快乐，你吃汤圆了吗",
        },
        methods: {
            changenum() {
                this.num++
            },
            changeinp(e) {
                this.cont = e.target.value
            }
        }
    })
</script>

</html>